package routers

import (
	"test/controller"

	"github.com/gin-gonic/gin"
)

func SetupRouter() *gin.Engine{
	r := gin.Default() 	//启动gin引擎
	//配置跨域
	// r.Use(cors.CorsHandler())

	// v1
	v1Group := r.Group("v1")
	{
		//添加
		v1Group.POST("/todo", controller.CreateTodo)
		//所有查看待办事项
		v1Group.GET("/todo", controller.GetTodoList)
		//修改
		v1Group.PUT("/todo/:id", controller.UpdateATodo)
		//删除
		v1Group.DELETE("/todo/:id", controller.DeleteATodo)
	}

	return r
}
